package com.bawei.house.adapter

import android.graphics.Color
import android.widget.TextView
import com.bawei.base.bean.HouseEntity
import com.bawei.house.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import org.w3c.dom.Text

class HouseAdapter:BaseQuickAdapter<HouseEntity,BaseViewHolder>(R.layout.item_housedetail) {
    override fun convert(helper: BaseViewHolder, item: HouseEntity) {
        helper.setText(R.id.house_title,item.regionName)
        helper.setText(R.id.house_companyId,item.enterpriseName)
        helper.setText(R.id.house_area,item.area.toString()+"㎡")
        val house_isRent = helper.getView<TextView>(R.id.house_isRent)
        if (item.rented){
            house_isRent.text="已出租"
            house_isRent.setTextColor(Color.RED)
            house_isRent.setBackgroundResource(R.drawable.shape_color1)
        }else{
            house_isRent.text="未出租"
            house_isRent.setTextColor(Color.GREEN)
            house_isRent.setBackgroundResource(R.drawable.shape_color2)
        }
    }
}